# Default values for elasticsearch-curator.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

cronjob:
  # At 01:00 every day
  schedule: "0 1 * * *"
  annotations: {}
  concurrencyPolicy: ""
  failedJobsHistoryLimit: ""
  successfulJobsHistoryLimit: ""

pod:
  annotations: {}

image:
  repository: {{ docker_elasticsearch_curator_repo }}
  tag: {{ docker_elasticsearch_curator_tag }}
  pullPolicy: IfNotPresent
  
hooks:
  install: false
  upgrade: false

# run curator in dry-run mode
dryrun: false

command: ["curator/curator"]
env: {}

configMaps:
  # Delete indices older than 7 days
  action_file_yml: |-
    ---
    actions:
      1:
        action: delete_indices
        description: "Clean up ES by deleting old logging indices"
        options:
          timeout_override:
          continue_if_exception: False
          disable_action: False
          ignore_empty_list: True
        filters:
        - filtertype: pattern
          kind: prefix
          value: ks-{{ common.es.elkPrefix }}-log
          exclude: False
        - filtertype: age
          source: name
          direction: older
          timestring: '%Y.%m.%d'
          unit: days
          unit_count: {{ common.es.logMaxAge }}
          field:
          stats_result:
          epoch:
          exclude: False
      2:
        action: delete_indices
        description: "Clean up ES by deleting old events indices"
        options:
          timeout_override:
          continue_if_exception: False
          disable_action: False
          ignore_empty_list: True
        filters:
        - filtertype: pattern
          kind: prefix
          value: ks-{{ common.es.elkPrefix }}-events
          exclude: False
        - filtertype: age
          source: name
          direction: older
          timestring: '%Y.%m.%d'
          unit: days
          unit_count: {{ common.es.eventMaxAge | default(common.es.logMaxAge) }}
          field:
          stats_result:
          epoch:
          exclude: False
      3:
        action: delete_indices
        description: "Clean up ES by deleting old auditing indices"
        options:
          timeout_override:
          continue_if_exception: False
          disable_action: False
          ignore_empty_list: True
        filters:
        - filtertype: pattern
          kind: prefix
          value: ks-{{ common.es.elkPrefix }}-auditing
          exclude: False
        - filtertype: age
          source: name
          direction: older
          timestring: '%Y.%m.%d'
          unit: days
          unit_count: {{ common.es.auditingMaxAge | default(common.es.logMaxAge) }}
          field:
          stats_result:
          epoch:
          exclude: False
      4:
        action: delete_indices
        description: "Clean up ES by deleting old istio indices"
        options:
          timeout_override:
          continue_if_exception: False
          disable_action: False
          ignore_empty_list: True
        filters:
        - filtertype: pattern
          kind: prefix
          value: {{ common.es.elkPrefix }}
          exclude: False
        - filtertype: age
          source: name
          direction: older
          timestring: '%Y.%m.%d'
          unit: days
          unit_count: {{ common.es.istioMaxAge | default(common.es.logMaxAge) }}
          field:
          stats_result:
          epoch:
          exclude: False
  # Having config_yaml WILL override the other config
  config_yml: |-
    ---
    client:
      hosts:
        - {% if common.es.externalElasticsearchHost is defined and common.es.externalElasticsearchHost != "" %}{{ common.es.externalElasticsearchHost }}{% else %}elasticsearch-logging-data.kubesphere-logging-system.svc{% endif %}

      port: {% if common.es.externalElasticsearchPort is defined and common.es.externalElasticsearchPort != "" %}{{ common.es.externalElasticsearchPort }}{% else %}9200{% endif %}
      
      # url_prefix:
      # use_ssl: True
      # certificate:
      # client_cert:
      # client_key:
      # ssl_no_validate: True
{% if common.es.basicAuth is defined and common.es.basicAuth.enabled is defined and common.es.basicAuth.enabled is true and common.es.basicAuth.username is defined and common.es.basicAuth.password is defined and common.es.basicAuth.username != "" and common.es.basicAuth.password != "" %}
      http_auth: {{ common.es.basicAuth.username }}:{{ common.es.basicAuth.password }}
{% endif %}
      # http_auth:
      # timeout: 30
      # master_only: False
    # logging:
    #   loglevel: INFO
    #   logfile:
    #   logformat: default
    #   blacklist: ['elasticsearch', 'urllib3']


resources: {}
  # We usually recommend not to specify default resources and to leave this as a conscious
  # choice for the user. This also increases chances charts run on environments with little
  # resources, such as Minikube. If you do want to specify resources, uncomment the following
  # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
  # limits:
  #  cpu: 100m
  #  memory: 128Mi
  # requests:
  #  cpu: 100m
  #  memory: 128Mi

priorityClassName: ""

# extraVolumes and extraVolumeMounts allows you to mount other volumes
# Example Use Case: mount ssl certificates when elasticsearch has tls enabled
# extraVolumes:
#   - name: es-certs
#     secret:
#       defaultMode: 420
#       secretName: es-certs
# extraVolumeMounts:
#   - name: es-certs
#     mountPath: /certs
#     readOnly: true

securityContext:
  runAsUser: 16  # run as cron user instead of root
